<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="s" uri="/struts-tags" %>
<%@ page import="com.onlineMIS.common.Common_util,java.util.Date,java.text.SimpleDateFormat" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>禧乐仓连锁店管理信息系统</title>
<%@ include file="../../common/Style.jsp"%>
<link href="<%=request.getContextPath()%>/conf_files/css/pagination.css" rel="stylesheet" type="text/css"/>
<SCRIPT src="<%=request.getContextPath()%>/conf_files/js/pagenav1.1.js" type=text/javascript></SCRIPT>
<script>
$(document).ready(function(){
	parent.$.messager.progress('close'); 
	
	var params = $.serializeObject($('#financeBillSearchForm')); 
	
	dataGrid =  $('#customerDataGrid').datagrid({
		url : 'financeHQJSON!searchFHQBill',
		queryParams: params,
		fit : true,
		fitColumns : true,
		pagination : true,
		pageSize : 15,
		pageList : [ 15, 30],

		checkOnSelect : false,
		selectOnCheck : false,
		singleSelect:true,
		showFooter:true,
		rownumbers:true,
		nowrap : false,
		sortName : '',
		sortOrder : 'asc',
		rowStyler: function(index,row){
			var style = "";
			if (row.status == 1)
				style += 'color:blue;';
			else if (row.status == 3)
				style += 'color:red;';				
			return style;
		},
		columns : [ [
				    {field:'id', width:3,title:'编号',sortable:true,order:'desc'},
					{field:'custName', width:8,title:'客户'},
					{field:'typeHQS', width:5,title:'单据种类'},
					{field:'billDate', width:5,title:'单据日期'},
					{field:'invoiceTotal', width:5,title:'金额',sortable:true,order:'desc'},
					{field:'statusS', width:5,title:'状态'},
					{field:'comment', width:10,title:'备注'},
					{
						field:'details', 
						width:5,
						title:'详情',
						formatter : function(value, row, index) {
							var str = '';
							var url = "financeHQJSP!getFHQ?formBean.order.id=" + row.id;
							var nodeTitle = "财务单据"+ row.id;
							if (row.id != 0){							  					
								 str += $.formatString('<a href="javascript:addTab3(\'{0}\',\'{1}\');"><img border="0" src="{2}" title="详情"/></a>',url,nodeTitle,'<%=request.getContextPath()%>/conf_files/easyUI/themes/icons/text_1.png');							
							}
							return str;
						}
					}
			     ]],
		toolbar : '#customerToolbar'
	
	});
});

function searchBills(){
	var params = $.serializeObject($('#financeBillSearchForm')); 
	$('#customerDataGrid').datagrid('load',params); 
}

pageNav.fn = function(page,totalPage){
	$.messager.progress({
		title : '提示',
		text : '数据处理中，请稍后....'
	});
	$("#currentPage").attr("value",page);
    var params=$("#financeBillSearchForm").serialize();  
    $.post("financeHQJSON!searchFHQBill",params, searchBillsBackProcess,"json");	
};
function downloadFQHBillExcel(){
	document.financeBillSearchForm.action="financeHQJSP!downloadFHQBill";
	document.financeBillSearchForm.submit();
}


</script>
</head>
<body>
<div class="easyui-layout" data-options="fit : true,border : false">
	<div data-options="region:'north',border:false" style="height: 145px;">
    <s:form id="financeBillSearchForm" name="financeBillSearchForm" action="/actionChain/inventoryFlowAction!searchInvenOrder" theme="simple" method="POST"> 
     <input type="hidden" id="isAll" name="formBean.isAll" value="1"/>
	 <input type="hidden" id="indicator" name="formBean.indicator" value="0"/>
     <table width="95%" align="center"  class="OuterTable">
	    <tr><td>
			 <table width="100%" border="0">
			    <tr>
			       <td height="50" colspan="7">
			            <div class="errorAndmes"><s:actionerror cssStyle="color:red"/><s:actionmessage cssStyle="color:blue"/></div>
				   		<table width="100%" border="0">
						    <tr class="PBAOuterTableTitale">
					          <td height="51" colspan="7">搜索财务单据<br />
				         		- 总部管理人员通过此功能可以查看与连锁客户之间的往来财务单据</td>
						    </tr>
						    <tr class="InnerTableContent">
						      <td width="50" height="25">&nbsp;</td>
						      
						      <td width="15%">开始日期 ：
						      	<s:textfield id="startDate" name="formBean.searchStartTime" cssClass="easyui-datebox" data-options="width:100,editable:false"/>
						      </td>
						       <td width="5%"><strong>单据状态</strong></td>
						      <td width="15%"><s:select name="formBean.order.status" cssClass="easyui-combobox" style="width:140px;text-align: center"  list="formBean.order.statusMap" listKey="key" listValue="value" headerKey="-1" headerValue="---全部---" /></td>
						   	  <td width="5%"><strong>客户</strong></td>
						      <td >
						      		<%@ include file="../include/ClientInput.jsp"%>

							 	</td>
						    </tr>
							<tr class="InnerTableContent">
						      <td width="50" height="25">&nbsp;</td>
						      
						      <td width="267">截止日期 ：
						         <s:textfield id="endDate" name="formBean.searchEndTime" cssClass="easyui-datebox" data-options="width:100,editable:false"/>
						      
						      <td><strong>单据种类</strong></td>
		                       <td><s:select name="formBean.order.type"  cssClass="easyui-combobox" style="width:140px;text-align: center" list="formBean.order.typeHQMap" listKey="key" listValue="value" headerKey="-1" headerValue="---全部---" /></td>
						   		<td></td>
						   		<td></td>
						    </tr>


						  </table>
					 </td>
			    </tr>
			    
			   
			  </table>
	   </td></tr>
	 </table>
	 
	 </s:form>
	</div>
	<div data-options="region:'center',border:false">
			<table id="customerDataGrid">
			</table>
		</div>
</div> 
		<div id="customerToolbar" style="display: none;">
		<s:if test="#session.LOGIN_USER.containFunction('financeHQJSON!searchFHQBill')"> 
				<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="searchBills();">搜索单据</a>
		 </s:if>
		<!-- financeBillTask -->
		<s:if test="#session.LOGIN_USER.containFunction('financeHQJSON!searchFHQBill')"> 
				<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print',plain:true" onclick="downloadFQHBillExcel();">下载单据</a>
		 </s:if>
	</div>

</body>
</html>